package cn.luischen.controller;

import cn.luischen.constant.ErrorConstant;
import cn.luischen.constant.Types;
import cn.luischen.constant.WebConst;
import cn.luischen.dto.ArchiveDto;
import cn.luischen.dto.cond.ContentCond;
import cn.luischen.exception.BusinessException;
import cn.luischen.model.CommentDomain;
import cn.luischen.model.ContentDomain;
import cn.luischen.service.comment.CommentService;
import cn.luischen.service.content.ContentService;
import cn.luischen.service.meta.MetaService;
import cn.luischen.service.option.OptionService;
import cn.luischen.service.site.SiteService;
import cn.luischen.utils.*;
import com.github.pagehelper.PageInfo;
import com.vdurmont.emoji.EmojiParser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;

import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.junit.rules.ExpectedException;
import org.junit.Test;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;
import java.lang.reflect.Method;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.parser.ParserConfig;
import java.util.Map;
import java.util.List;
import com.unitspirit.runtime.*;

/**
 * The class contains tests for the class cn.luischen.controller.HomeController.
 *
 * @generatedBy UnitSpirit CreateTemplateTestFile4
 * @version 1.0.9.11 
 */
@PowerMockIgnore({ "javax.management.*" })
@RunWith(PowerMockRunner.class)
@PrepareForTest({ cn.luischen.dto.cond.ContentCond.class })
public class HomeController_blogIndex_WGTest {
	@Rule
	public ExpectedException unitspirit_thrown = ExpectedException.none();

	/**
	 * 测试方法初始化.
	 * 
	 * @throws Exception 
	 *         if the initialization fails for some reason 
	 *  
	 * @generatedBy UnitSpirit at 2021-12-08 11:01:07
	 */
	@org.junit.Before
	public void setUp() throws Exception {
		try {
			GlobalUnitInit.init();
			MockitoAnnotations.initMocks(this);
			ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	@InjectMocks
	cn.luischen.controller.HomeController unitspirit_fixture;

	@Mock
	cn.luischen.service.comment.CommentService mock_CommentService;
	@Mock
	cn.luischen.service.site.SiteService mock_SiteService;
	@Mock
	cn.luischen.service.option.OptionService mock_OptionService;
	@Mock
	cn.luischen.service.content.ContentService mock_ContentService;
	@Mock
	cn.luischen.service.meta.MetaService mock_MetaService;

	/**
	 * @date 2021-12-08 11:01:08
	 * @see cn.luischen.controller.HomeController#blogIndex
	 * @category null  
	 * @author UnitSpirit   
	 */
	@Test
	public void test_blogIndex_0907_083747_975_2_01() throws Throwable {
		unitspirit_fixture = PowerMockito.spy(unitspirit_fixture);
		//被测函数参数定义
		javax.servlet.http.HttpServletRequest HttpServletRequest_p_0 = Mockito
				.mock(javax.servlet.http.HttpServletRequest.class);
		int int_p_1 = 11;
		//成员变量设置

		//返回值定义 
		String result_expected = "";

		String unitspirit_result = unitspirit_fixture.blogIndex(
				HttpServletRequest_p_0, int_p_1);
		assertEquals(result_expected, unitspirit_result);
	}

	/**
	 * @date 2021-12-08 11:01:08
	 * @see cn.luischen.controller.HomeController#blogIndex
	 * @category null  
	 * @author UnitSpirit   
	 */
	@Test
	public void test_blogIndex_0907_083749_470_3_02() throws Throwable {
		//被测函数参数定义
		javax.servlet.http.HttpServletRequest HttpServletRequest_p_0 = Mockito
				.mock(javax.servlet.http.HttpServletRequest.class);
		int int_p_1 = 1;
		int int_p_2 = 11;
		//成员变量设置

		//返回值定义 
		String result_expected = "";

		cn.luischen.dto.cond.ContentCond mock_sub_caller_ContentCond6 = PowerMockito
				.mock(cn.luischen.dto.cond.ContentCond.class);
		String Stringmock5_0 = "post";
		String Stringrepeat_mock3_0 = "articles";
		Object Objectrepeat_mock3_1 = "{\"navigatepageNums\":[1],\"startRow\":1,\"hasNextPage\":false,\"prePage\":0,\"nextPage\":0,\"endRow\":2,\"pageSize\":11,\"list\":[{\"created\":1598863392,\"modified\":1598863413,\"allowComment\":1,\"categories\":\"\",\"title\":\"asd\",\"type\":\"post\",\"content\":\"sadasdzcxas\",\"cid\":29,\"status\":\"publish\",\"tags\":\"asdqw,wqe123\"},{\"created\":1592293543,\"modified\":0,\"allowComment\":1,\"categories\":\"默认分类\",\"title\":\"MOCK使用矩阵\",\"type\":\"post\",\"content\":\"MOCK使用矩阵\r\nMOCK使用矩阵\r\nMOCK使用矩阵\r\nMOCK使用矩阵\",\"cid\":27,\"status\":\"publish\",\"tags\":\"MOCK使用矩阵\"}],\"pageNum\":1,\"navigatePages\":8,\"navigateFirstPage\":1,\"total\":2,\"pages\":1,\"size\":2,\"isLastPage\":true,\"hasPreviousPage\":false,\"navigateLastPage\":1,\"isFirstPage\":true}";
		String Stringrepeat_mock2_0 = "type";
		Object Objectrepeat_mock2_1 = "articles";
		String Stringrepeat_mock1_0 = "active";
		Object Objectrepeat_mock1_1 = "blog";

		PowerMockito.whenNew(cn.luischen.dto.cond.ContentCond.class)
				.withNoArguments().thenReturn(mock_sub_caller_ContentCond6);
		PowerMockito.doNothing().when(mock_sub_caller_ContentCond6)
				.setType(anyString());
		PowerMockito.doReturn(null).when(mock_sub_caller_ContentCond6,
				"getType");

		String unitspirit_result = unitspirit_fixture.blogIndex(
				HttpServletRequest_p_0, int_p_1, int_p_2);
		assertEquals(result_expected, unitspirit_result);
	}
  /**
  * @date 2021-12-08 11:01:08
  * @see cn.luischen.controller.HomeController#blogIndex
  * @category null  
  * @author UnitSpirit   
  */
  @Test
  public void test_blogIndex_0907_083749_470_3_01() throws Throwable {
    //被测函数参数定义
    javax.servlet.http.HttpServletRequest HttpServletRequest_p_0 = Mockito.mock(javax.servlet.http.HttpServletRequest.class);
    int int_p_1 = 1;
    int int_p_2 = 11;
  //成员变量设置


    //返回值定义 
    String result_expected = "";

    cn.luischen.dto.cond.ContentCond mock_sub_caller_ContentCond6 = PowerMockito.mock(cn.luischen.dto.cond.ContentCond.class);
    String Stringmock5_0 = "post";
    String Stringrepeat_mock3_0 = "articles";
    Object Objectrepeat_mock3_1 = "{\"navigatepageNums\":[1],\"startRow\":1,\"hasNextPage\":false,\"prePage\":0,\"nextPage\":0,\"endRow\":2,\"pageSize\":11,\"list\":[{\"created\":1598863392,\"modified\":1598863413,\"allowComment\":1,\"categories\":\"\",\"title\":\"asd\",\"type\":\"post\",\"content\":\"sadasdzcxas\",\"cid\":29,\"status\":\"publish\",\"tags\":\"asdqw,wqe123\"},{\"created\":1592293543,\"modified\":0,\"allowComment\":1,\"categories\":\"默认分类\",\"title\":\"MOCK使用矩阵\",\"type\":\"post\",\"content\":\"MOCK使用矩阵\r\nMOCK使用矩阵\r\nMOCK使用矩阵\r\nMOCK使用矩阵\",\"cid\":27,\"status\":\"publish\",\"tags\":\"MOCK使用矩阵\"}],\"pageNum\":1,\"navigatePages\":8,\"navigateFirstPage\":1,\"total\":2,\"pages\":1,\"size\":2,\"isLastPage\":true,\"hasPreviousPage\":false,\"navigateLastPage\":1,\"isFirstPage\":true}";
    String Stringrepeat_mock2_0 = "type";
    Object Objectrepeat_mock2_1 = "articles";
    String Stringrepeat_mock1_0 = "active";
    Object Objectrepeat_mock1_1 = "blog";

    PowerMockito.whenNew(cn.luischen.dto.cond.ContentCond.class).withNoArguments().thenReturn( mock_sub_caller_ContentCond6);
    PowerMockito.doNothing().when( mock_sub_caller_ContentCond6).setType(anyString());
    PowerMockito.doReturn(null).when( mock_sub_caller_ContentCond6,"getType");

    String  unitspirit_result =  unitspirit_fixture.blogIndex(HttpServletRequest_p_0,int_p_1,int_p_2);
    assertEquals(result_expected,unitspirit_result);
  }
  /**
  * @date 2021-12-08 11:01:08
  * @see cn.luischen.controller.HomeController#blogIndex
  * @category null  
  * @author UnitSpirit   
  */
  @Test
  public void test_blogIndex_1207_113932_450_2_01() throws Throwable {
    unitspirit_fixture = PowerMockito.spy(unitspirit_fixture);
    //被测函数参数定义
    javax.servlet.http.HttpServletRequest HttpServletRequest_p_0 = Mockito.mock(javax.servlet.http.HttpServletRequest.class);
    int int_p_1 = 11;
  //成员变量设置


    //返回值定义 
    String result_expected = "\"site/blog\"";



    String  unitspirit_result =  unitspirit_fixture.blogIndex(HttpServletRequest_p_0,int_p_1);
  //getAssertCase 
    UnitAssert.assertEquals(result_expected,unitspirit_result);
  }
  /**
  * @date 2021-12-08 11:01:08
  * @see cn.luischen.controller.HomeController#blogIndex
  * @category null  
  * @author UnitSpirit   
  */
  @Test
  public void test_blogIndex_1207_113938_992_2_01() throws Throwable {
    //被测函数参数定义
    javax.servlet.http.HttpServletRequest HttpServletRequest_p_0 = Mockito.mock(javax.servlet.http.HttpServletRequest.class);
    int int_p_1 = 1;
    int int_p_2 = 11;
  //成员变量设置


    //返回值定义 
    String result_expected = "\"site/blog\"";

    cn.luischen.dto.cond.ContentCond mock_sub_caller_ContentCond3 = PowerMockito.mock(cn.luischen.dto.cond.ContentCond.class);
    String Stringmock2_0 = "post";
    String mock_result_String1 = "\"post\"";

    PowerMockito.whenNew(cn.luischen.dto.cond.ContentCond.class).withNoArguments().thenReturn( mock_sub_caller_ContentCond3);
    PowerMockito.doNothing().when( mock_sub_caller_ContentCond3).setType(anyString());
    PowerMockito.when( mock_sub_caller_ContentCond3.getType()).thenReturn( mock_result_String1);

    String  unitspirit_result =  unitspirit_fixture.blogIndex(HttpServletRequest_p_0,int_p_1,int_p_2);
  //getAssertCase 
    UnitAssert.assertEquals(result_expected,unitspirit_result);
  }
}